attachDmaBufRing

fun MapHandle.attachDmaBufRing(descriptor: DmaBufRingDescriptor, device: VulkanDeviceHandle? = null, options: RenderSessionAttachOptions): RenderSessionHandle

Creates a session that renders the map into a ring of dmabufs that the library allocates.

Acquire each frame with RenderSessionHandle.acquireFrame(), and get its buffer with AcquiredFrameHandle.withDmaBuf(). RenderSessionHandle.resize() gives the ring new buffers of the new size.

A Vulkan build renders with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context of its own, and device must be null. Attach with RenderDriverKind.CORE_WORKER.

For a reader that waits on no sync file, such as a Wayland compositor without explicit synchronization, attach without GpuSyncKindFlag.SYNC_FD in RenderSessionAttachOptions.producerSyncKinds, so that each frame finishes before you acquire it. Keep each frame acquired until its reader is done with the buffer. Give the ring 3 buffers, so the session can render while you hold two frames.

See mln_map_attach_dma_buf_ring in the C API reference.

Errors:

  • Status.UNSUPPORTED when the graphics context can't render into a dmabuf of any of formats.

  • Status.NATIVE_ERROR when the library can't create its Vulkan device or initialize an EGL display.